<?php

/**
 * Chronicle form base class.
 *
 * @method Chronicle getObject() Returns the current form's model object
 *
 * @package    rpgcom
 * @subpackage form
 * @author     Your name here
 */
abstract class BaseChronicleForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'idChronicle'   => new sfWidgetFormInputHidden(),
      'name'          => new sfWidgetFormInputText(),
      'description'   => new sfWidgetFormTextarea(),
      'idStoryteller' => new sfWidgetFormPropelChoice(array('model' => 'User', 'add_empty' => false)),
      'idSupplement'  => new sfWidgetFormPropelChoice(array('model' => 'Supplement', 'add_empty' => false)),
      'dtIni'         => new sfWidgetFormDate(),
      'dtEnd'         => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'idChronicle'   => new sfValidatorPropelChoice(array('model' => 'Chronicle', 'column' => 'idChronicle', 'required' => false)),
      'name'          => new sfValidatorString(array('max_length' => 50)),
      'description'   => new sfValidatorString(),
      'idStoryteller' => new sfValidatorPropelChoice(array('model' => 'User', 'column' => 'idUser')),
      'idSupplement'  => new sfValidatorPropelChoice(array('model' => 'Supplement', 'column' => 'idSupplement')),
      'dtIni'         => new sfValidatorDate(),
      'dtEnd'         => new sfValidatorDate(),
    ));

    $this->widgetSchema->setNameFormat('chronicle[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Chronicle';
  }


}
